﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using FoneBuddy.LinqModel;
using FoneBuddy.LinqModel.Data;
using FoneBuddy.LinqData;
using System.Globalization;

public partial class Color_List : System.Web.UI.Page
{
    IDataRepository _dataObject = new DataRepository();
    Color Color;
    List<Color> Colors = new List<Color>();

    #region pageload
    protected void Page_Load(object sender, EventArgs e)
    {
        //CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName();
        if (!IsPostBack)
            getColor();
    }
    #endregion

    

    #region delete
    protected void OnDelete(object sender, EventArgs e)
    {
        try
        {
            LinkButton lnk = sender as LinkButton;
            Int32 Id = Convert.ToInt32(lnk.CommandArgument);
            Color = new Color(_dataObject);
            Color.Id = Id;
            Color.Delete();
            getColor();
        }
        catch (Exception ex)
        {

        }
    }
  
    #endregion

    #region getdata
    private void getColor()
    {
        Color = new Color(_dataObject);

        Colors = Color.GetAllColor();

        if (Colors != null)
        {
            rptColor.DataSource = Colors;
            rptColor.DataBind();
        }
    }
    #endregion
}